QuickTime 3 Reference

Previous | Chapter Top | Chapter Contents | Next

Storing Captured Data in Multiple Files

In QuickTime 3, the sequence grabber allows a single capture session to store the captured data across multiple files. Each channel of a capture can be placed in a separate file. In this way, sound and video can be captured to separate files, even on separate devices. It is also possible to have a single capture session place its data on several different devices in sequence. As a result, several different devices can be used in a single capture session. This enables data capture to exceed any file size limitation imposed by a file system.

The file offset parameter supports 64-bit file offsets in APIs that enable capture to multiple files. The QuickTime Movie Toolbox does not currently support 64-bit file offsets, so the high 32 bits of the offset is always 0000.

Application Examples

The first step in implementing multiple sequence grabber outputs during a single capture session is to create all the sequence grabber outputs. Once the outputs have been created, they must be linked together. This is done using the new SGSetOutputNextOutput routine. The linked outputs are used in link order. An example of creating and linking two sequence grabber outputs is shown in Listing 7-1 .

Listing 1 Creating and linking sequence grabber outputs

OSErr FSSpecToSGOutput(SeqGrabComponent theSG, FSSpec *fss,SGOutput *output)
{
    OSErr err;
    AliasHandle alias = nil;
    err = QTNewAlias(&fss, &alias, true);
    err = SGNewOutput(theSG, (Handle)alias, rAliasType,
        seqGrabToDisk, output);
    FSSpec fss;
    SGOutput output1, output2;

    // create an FSSpec for the first file
    FSMakeFSSpec(0, 0, "\pMacintosh HD:Movie 1", &fss);

    // create the output for the first file
    FSSpecToSGOutput(theSG, &fss, &output1)

    // create an FSSpec for the second file
    FSMakeFSSpec(0, 0, "\pMacintosh HD:Movie 2", &fss);

    //create the output for the second file
    FSSpecToSGOutput(theSG, &fss, &output2)

    // direct the movie resource to the first file
    err = SGSetDataOutput(theSG, fss, seqGrabToDisk);
    if (err) goto exit;

    // finally, link the outputs
    SGSetOutputNextOutput(theSG, output1, output2);
}

In this example two separate outputs are created. Once these outputs are created, they are linked together using SGSetOutputNextOutput . The output output1 is used first. Once that output is full, output2 is used.

Once outputs are created, they must be associated with the sequence grabber channels that write data to these outputs. Listing 7-2 shows how this can be accomplished. This example shows how to associate the outputs created in Listing 7-2 with both a sound and a video channel.

Listing 2 Associating outputs with channels

//associate both sound and video channels with all linked outputs
SGSetChannelOutput(theSG, soundChannel, output1);
SGSetChannelOutput(theSG, videoChannel, output1);

You can limit output files to a particular size by specifying the maximum number of bytes to be written to a given sequence grabber output. Listing 7-3 shows an example of setting a maximum offset of 64 KB for data written to an output.

Listing 3 Specifying maximum data offset for an output

wide maxOffset;
maxOffset.hi = 0;
//set the offset to 64K
maxOffset.lo = 64 * 1024;
SGSetOutputMaximumOffset(theSG, output1, &maxOffset);

© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next